package cn.edu.zafu.bigdata.x.zzzznnn;

// 定义接口 Movable
interface Movable {
    void move();
    void stop();
}

// 定义接口 Resizable
interface Resizable {
    void resize(double factor);
}

// 实现 Movable 接口的 Car 类
class Car implements Movable {
    @Override
    public void move() {
        System.out.println("The car is moving.");
    }

    @Override
    public void stop() {
        System.out.println("The car has stopped.");
    }
}

// 实现 Movable 和 Resizable 接口的 ResizableCircle 类
class ResizableCircle implements Movable, Resizable {
    private double radius;// 半径属性

    public ResizableCircle(double radius) {
        this.radius = radius;
    }

    @Override
    public void move() {
        System.out.println("The circle is moving.");
    }

    @Override
    public void stop() {
        System.out.println("The circle has stopped.");
    }

    @Override
    public void resize(double factor) {
        this.radius *= factor;
        System.out.println("The circle's radius is now: " + this.radius);
    }
}

// 测试类 TestInterface
public class TestInterface {
    public static void main(String[] args) {
        // 创建 Car 和 ResizableCircle 的实例
        Car car = new Car();
        ResizableCircle resizableCircle = new ResizableCircle(5.0);

        // 验证 Car 类对接口方法的实现
        System.out.println("Testing Car:");
        car.move();
        car.stop();

        // 验证 ResizableCircle 类对接口方法的实现
        System.out.println("\nTesting ResizableCircle:");
        resizableCircle.move();
        resizableCircle.stop();
        resizableCircle.resize(2.0); // 假设缩放因子为2
    }
}

